from django.db import models

# Create your models here.
from device.base import Constant
from device.device import Device
from device.user import User


class UserBlackList(models.Model):
    class Meta:
        verbose_name = u'60. 用户黑名单'
        verbose_name_plural = u'60. 用户黑名单'
        db_table = 'api_userblacklist'
        app_label = 'api'

    # 延迟导入，避免循环依赖

    user = models.CharField(max_length=11, null=True, blank=True, default='', help_text=u"手机号", verbose_name=u"手机号")
    bind_user = models.ForeignKey(User, null=True, blank=True, default=None, verbose_name=u"绑定用户",
                                  on_delete=models.SET_DEFAULT)
    device = models.ForeignKey(Device, null=True, blank=True, default=None, verbose_name=u'设备号',
                               on_delete=models.SET_DEFAULT)
    reason = models.CharField(choices=Constant.BLOCK_USER_REASON,
                              default='0',
                              max_length=1,
                              help_text=u'屏蔽原因',
                              verbose_name=u'屏蔽原因')
    add_time = models.DateTimeField(auto_now_add=True, verbose_name=u'添加时间')
